# @Author   : baili
# @File     : project_dao
# @Time     : 2022/5/11 14:27
import datetime
import logging
from typing import List, Optional

from csr_utils import log

from dao.base_dao import BaseDao
from orm_domain.project import Project
from server import db_session

class ProjectDao(BaseDao):

    def save(self, project: Project):
        """
        新增操作
        """
        return self.add(project)

    def get_list(self, **filter_by) -> List[Project]:
        """
        查询操作：全部
        """
        return self.query(Project).filter_by(**filter_by).all()

    def get(self, **filter_by) -> Optional[Project]:
        """
        查询操作：单条记录
        """
        return self.query(Project).filter_by(**filter_by).first()

    def update(self):
        """
        更新操作
        """
        return self.commit()

    def delele(self):
        """
        删除操作：逻辑删除
        """
        return self.commit()
